package com.ruitu.mall_98_2.mvp.model;

import com.ruitu.mall_98_2.dao.APIRetrofit;
import com.ruitu.mall_98_2.mvp.contract.AddAddressContract;
import com.ruitu.router_module.bean.api.BaseResult;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class AddAddressModel implements AddAddressContract.Model {
    @Override
    public Observable<BaseResult> addAddress(String userId, String ressName, String province, String city, String county, String address, String postCode, String phoneNumber, String status) {
        return APIRetrofit.getDefault().addAddress(userId, ressName, province, city, county, address, postCode, phoneNumber, status)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    @Override
    public Observable<BaseResult> updateAddress(String userId, String ressName, String province, String city, String county, String address, String postCode, String phoneNumber, String status) {
        return APIRetrofit.getDefault().updateAddress(userId, ressName, province, city, county, address, postCode, phoneNumber, status)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }
}
